# We will define the home page class and methods using the Page Object model in Python

class HomePage:
    def __init__(self, page):
        self.page = page
        self.search_term_input = page.locator('#chat-textarea')
        # self.search_term_input = page.locator('textarea').to_have_id('chat-textarea')

    def navigate_to_homepage(self):
        self.page.goto("http://www.baidu.com")
        self.page.locator("button:text('百度一下')").wait_for(timeout=20000)

    def search(self, text):
        self.search_term_input.fill(text)
        self.search_term_input.press("Enter")

    @property  # <-- added for the query "定义该函数为属性"
    def get_title(self):
        # Get the title of the page
        title = self.page.title()
        return title
